package wang.hu.bos.service.Impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import wang.hu.bos.dao.StandardDao;
import wang.hu.bos.domain.base.Standard;
import wang.hu.bos.service.StandardService;

@Service
@Transactional
public class StandardServiceImpl implements StandardService {
	@Autowired
	private StandardDao standardDao;

	@Override
	public void save(Standard standard) {
		standardDao.save(standard);

	}

	@Override
	public Page<Standard> findAll(int page, int size) {
		Pageable pageable = new PageRequest(page, size);
		return standardDao.findAll(pageable);
	}

	@Override
	public List<Standard> findAllName() {

		return standardDao.findAll();
	}

	@Override
	public void updateSign(String ids) {
		String[] array = ids.split(",");
		for (String id : array) {
			standardDao.delete(Integer.parseInt(id));
		}
	}

}
